package com.xdb.sqlparser.ast.statement;

import com.xdb.sqlparser.ast.AbstractSQLObjectImpl;
import com.xdb.sqlparser.visitor.SQLAstVisitor;

public class SQLAlterTableAddConstraint extends AbstractSQLObjectImpl implements SQLAlterTableItem {

	private SQLConstraint constraint;
	private boolean withNoCheck = false;

	public SQLAlterTableAddConstraint() {

	}

	public SQLAlterTableAddConstraint(SQLConstraint constraint) {
		this.setConstraint(constraint);
	}

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, constraint);
		}
		visitor.endVisit(this);
	}

	public SQLConstraint getConstraint() {
		return constraint;
	}

	public void setConstraint(SQLConstraint constraint) {
		if (constraint != null) {
			constraint.setParent(this);
		}
		this.constraint = constraint;
	}

	public boolean isWithNoCheck() {
		return withNoCheck;
	}

	public void setWithNoCheck(boolean withNoCheck) {
		this.withNoCheck = withNoCheck;
	}

}
